var search = document.querySelector('.search');
var wrap = document.querySelector('.wrap');
var ad = document.querySelector('.p_slider_wrap');
console.log(ad.children[0])
var cha = ad.children[0];
cha.onclick = function () {
    ad.style.display = 'none';
}

window.onscroll = function () {
    var height = wrap.getBoundingClientRect().top;
    console.log(height);
    if (height == 0) {
        search.style.background = 'transparent';
        search.children[0].style.background = '#fff';
        search.children[1].style.color = '#fff';
        search.children[1].children[0].style.backgroundPosition = '1px -35px';
    } else {
        search.style.background = '#fff';
        search.children[0].style.background = '#ececed';
        search.children[1].style.color = '#222';
        search.children[1].children[0].style.backgroundPosition = '1px -77px';
    }
}